package com.sunducation.wts.room

import androidx.room.Database
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.sunducation.wts.room.bean.*
import com.sunducation.wts.room.bean2.Cat
import com.sunducation.wts.room.bean2.Dog
import com.sunducation.wts.room.bean2.Owner
import com.sunducation.wts.room.dao.*
import com.sunducation.wts.room.dao2.CatDao
import com.sunducation.wts.room.dao2.DogDao
import com.sunducation.wts.room.dao2.OwnerDao
import com.sunducation.wts.room.more2more.bean.PlayList
import com.sunducation.wts.room.more2more.bean.PlaylistSongCrossRef
import com.sunducation.wts.room.more2more.bean.Song
import com.sunducation.wts.room.more2more.dao.PlaylistSongCrossRefDao
import com.sunducation.wts.room.one2more.bean.TwoDog
import com.sunducation.wts.room.one2more.bean.TwoOwner
import com.sunducation.wts.room.one2more.dao.TwoOwnerWithDogsDao
import com.sunducation.wts.room.one2one.bean.OneDog
import com.sunducation.wts.room.one2one.bean.OneOwner
import com.sunducation.wts.room.one2one.dao.OneDogAndOwnerDao

/*@Database(entities = arrayOf(User::class,
    User2::class,
    User3::class,
    User5::class,
    Book::class,
    Owner::class,
    Dog::class,
    Cat::class
    ), version = 1)*/
//数组可以用[]或者arrayOf
@Database(entities = [User::class,
    User2::class,
    User3::class,
    User5::class,
    Book::class,
    Owner::class,
    Dog::class,
    Cat::class,
    OneOwner::class,
    OneDog::class,
    TwoDog::class,
    TwoOwner::class,
    PlayList::class,
    Song::class,
    PlaylistSongCrossRef::class
], version = 1)
@TypeConverters(value = arrayOf(DateConverters::class)) //类型转换
abstract class AppDatabase : RoomDatabase() {
    abstract fun userDao(): UserDao
    abstract fun user2Dao(): User2Dao
    abstract fun user3Dao(): User3Dao
    abstract fun user5Dao(): User5Dao
    abstract fun bookDao(): BookDao
    abstract fun ownerDao(): OwnerDao
    abstract fun dogDao(): DogDao
    abstract fun catDao(): CatDao
    abstract fun oneDogAndOwnerDao(): OneDogAndOwnerDao
    abstract fun twoOwnerWithDogsDao(): TwoOwnerWithDogsDao
    abstract fun playlistSongCrossRefDao(): PlaylistSongCrossRefDao
}